<template>
	<view class="commodity" :style="'flex-wrap:'+wrap+';'">
		<!-- 单个商品 -->
		<view class="commodity-item" v-for="item in dataList" :key="item.id" :style="'width:'+itemWidth+';'">
			<image :style="'height:'+bigH+';'" class="commodity-img" :src="item.imgUrl" mode=""></image>
			<view class="commodity-content">
				<text class="commodity-name" :style="'font-size:'+fontSize+';'">{{item.name}}</text>
				<view class="">
					<text class="pprice">￥{{item.pprice}}</text>
					<text class="oprice">￥{{item.oprice}}</text>
				</view>
				<text class="discount">{{item.discount}}折</text>
			</view>
		</view>
		
	</view>
</template>

<script>
export default{
	props:{
		dataList:{
			type:Array
		},
		itemWidth:{
			type:String,
			default:"375rpx"
		},
		bigH:{
			type:String,
			default:"375rpx"
		},
		wrap:{
			type:String,
			default:"wrap"
		},
		fontSize:{
			type:String,
			default:"26rpx"
		}
	}
}
</script>

<style scoped>
.commodity{
	display: flex;
	
}
.commodity-item{
	width: 375rpx;
	padding-bottom: 20rpx;
}
.commodity-img{
	width: 100%;
}
.commodity-content{
	text-align: center;
}
.commodity-name{
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp:2;
	-webkit-box-orient: vertical;
	word-break: break-all;
	color: #333333;
	padding: 6rpx 20rpx;
	font-size: 26rpx;
}
.oprice{
	text-decoration: line-through;
	font-size: 24rpx;
	color: #999999;
}
.discount{
	border-radius: 4rpx;
	border: 1rpx solid #ff3333;
	padding: 2rpx 10rpx;
	color:#FF3333;
	font-size: 20rpx;
}
</style>